LIB=libmylib.so
OBJ=$(SRC:.c=.o)
SRC=$(wildcard *.c)
TOOL=gcc
CC=gcc

DIR1=mylib
DIR1/1=include
DIR1/2=lib

$(LIB):$(OBJ)
	@$(TOOL) -shared -o $@ $^
	
%.o:%.c
	@$(CC) -fPIC -c $< 

.PHONY:clean
clean:
	@rm -rf $(OBJ) $(LIB) $(DIR1)

.PHONY:output
output:
	@mkdir -p $(DIR1)
	@mkdir -p $(DIR1)/$(DIR1/1)
	@mkdir -p $(DIR1)/$(DIR1/2)
	@cp *.h $(DIR1)/$(DIR1/1)
	@cp $(LIB) $(DIR1)/$(DIR1/2)



#main.c
#makefile
#mystdio.c
#mystdio.h
#mystring.c
#mystring.h
